home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 17 / Computer Interactive cdrom 17 - gen 99.iso / ZDNETIT / CONTENT / OPTIVDOS.ZIP / INCLUDE.ZIP / VGRAPH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-21  |  17.9 KB  |  399 lines

  1. /*  Vgraph.h
  2.  
  3.   graphics functions for all floating-point and integer vector types
  4.  
  5.   Copyright (c) 1996-1998 by Martin Sander
  6.   All Rights Reserved.
  7. */
  8.  
  9. #ifndef __VGRAPH_H
  10. #define __VGRAPH_H
  11. #if !defined( __VECLIB_H )
  12.    #include <VecLib.h>
  13. #endif
  14.  
  15. #if defined _WINDOWS
  16.     #if defined _MSC_VER
  17.         #include <afxwin.h>
  18.     #elif defined __BORLANDC__
  19.         /* OWL include files must have been included before <VGraph>! */
  20.     #else  /* that means: Optima++ */
  21.         #include <WCanvas.hpp>
  22.         #include <WColor.hpp>
  23.         #define COLORREF WColor
  24.     #endif
  25. #else
  26.   #if defined( __WINDOWS_H )
  27.      #error <windows.h> must not be included, if program will run under DOS!
  28.   #endif
  29.   #include <graphics.h>
  30.   #define COLORREF unsigned   /* in <windows.h> defined as DWORD! */
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37.  
  38. /********************  Plot-Routines **************************/
  39.  
  40. #if defined __BORLANDC__
  41.     #if defined _Windows /* use Borland's OWL  */
  42.         void  __vf  V_initPlot( HWND vhwnd, HDC vdc );
  43.     #else   /*  DOS: use Borland's BGI   */
  44.         void  __vf  V_initGraph( char _VFAR *pathtodriver );
  45.         void  __vf  V_initPlot( int graphmode );
  46.     #endif
  47. #elif defined _MSC_VER    /* use MicrosoftFoundationClasses  */
  48.         void  __vf  V_initPlot( CDC _VFAR *vdc );
  49. #else  /* Powersoft Optima++ */
  50.         void  __vf  V_initPlot( WCanvas _VFAR *vcanv );
  51. #endif
  52. #ifdef _WINDOWS
  53.     #if defined __BORLANDC__ || defined _MSC_VER
  54.         void  __vf  V_initPrint( HDC vprintdc );
  55.     #else  /* Optima++ */
  56.         void  __vf  V_initPrint( WPrinterCanvas _VFAR *vcanvas );
  57.     #endif
  58. #endif
  59. void  __vf  V_setPlotRegion( int left, int top, int right, int bottom );
  60. void  __vf  V_setSymbolSize( float symsize );
  61. void  __vf  V_setLineThickness( unsigned thickness );
  62. int   __vf  V_findAxisRange( extended _VFAR *LoX, extended _VFAR *HiX,
  63.                              extended Xmin, extended Xmax );
  64. void  __vf  V_findAxes( extended Xmin, extended Xmax,
  65.                         extended Ymin, extended Ymax );
  66. void  __vf  V_drawAxes( extended Xmin, extended Xmax,
  67.                         extended Ymin, extended Ymax );
  68. void  __vf  V_continuePlot( void );
  69.  
  70. #ifdef __BORLANDC__
  71.     #pragma option -a-
  72. #else /* Visual C++ */
  73.     #pragma pack( push,1 )
  74. #endif /* avoid insertion of dummy bytes  */
  75. typedef struct {
  76.       int         left, top, right, bottom,
  77.                   outleft, outtop, outright, outbottom,
  78.                   nPixx, nPixy,
  79.                   xclipu, xclipl, yclipu, yclipl,
  80.                   cs, cl, cdot;
  81.       unsigned    linethickness, symlinethickness, DangerOver;
  82.       float       symbolsize, x_scale, y_scale;
  83.       extended    x_max, x_min, x_range, x_maxoverrange,
  84.                   y_max, y_min, y_range, y_maxoverrange;
  85.       } VCOORDSYSTEM;
  86. #ifdef __BORLANDC__
  87.        #pragma option -a.
  88. #else /* Visual C++ */
  89.        #pragma pack( pop )
  90. #endif    /* restore default data packing  */
  91.  
  92. void  __vf  V_setCoordSystem( VCOORDSYSTEM _VFAR *xcs );
  93. void  __vf  V_getCoordSystem( VCOORDSYSTEM _VFAR *xcs );
  94.  
  95. void  __vf  VF_xyAutoPlot(  fVector X, fVector Y, ui size,
  96.                             unsigned form, COLORREF color );
  97. void  __vf  VF_xy2AutoPlot( fVector X1, fVector Y1, ui size1,
  98.                             unsigned form1, COLORREF color1,
  99.                             fVector X2, fVector Y2, ui size2,
  100.                             unsigned form2, COLORREF color2 );
  101. void  __vf  VF_xyDataPlot(  fVector X, fVector Y, ui size,
  102.                             unsigned form, COLORREF color );
  103. void  __vf  VF_yAutoPlot(   fVector Y, ui size,
  104.                             unsigned form, COLORREF color );
  105. void  __vf  VF_y2AutoPlot(  fVector Y1, ui size1,
  106.                             unsigned form1, COLORREF color1,
  107.                             fVector Y2, ui size2,
  108.                             unsigned form2, COLORREF color2 );
  109. void  __vf  VF_yDataPlot(   fVector Y, ui size,
  110.                             unsigned form, COLORREF color );
  111. void  __vf  VCF_autoPlot(   cfVector X, ui size,
  112.                             unsigned form, COLORREF color );
  113. void  __vf  VCF_2AutoPlot(  cfVector X1, ui size1,
  114.                             unsigned form1, COLORREF color1,
  115.                             cfVector X2, ui size2,
  116.                             unsigned form2, COLORREF color2 );
  117. void  __vf  VCF_dataPlot(   cfVector X, ui size,
  118.                             unsigned form, COLORREF color );
  119.  
  120. void  __vf  VD_xyAutoPlot(  dVector X, dVector Y, ui size,
  121.                             unsigned form, COLORREF color );
  122. void  __vf  VD_xy2AutoPlot( dVector X1, dVector Y1, ui size1,
  123.                             unsigned form1, COLORREF color1,
  124.                             dVector X2, dVector Y2, ui size2,
  125.                             unsigned form2, COLORREF color2 );
  126. void  __vf  VD_xyDataPlot(  dVector X, dVector Y, ui size,
  127.                             unsigned form, COLORREF color );
  128. void  __vf  VD_yAutoPlot(   dVector Y, ui size,
  129.                             unsigned form, COLORREF color );
  130. void  __vf  VD_y2AutoPlot(  dVector Y1, ui size1,
  131.                             unsigned form1, COLORREF color1,
  132.                             dVector Y2, ui size2,
  133.                             unsigned form2, COLORREF color2 );
  134. void  __vf  VD_yDataPlot(   dVector Y, ui size,
  135.                             unsigned form, COLORREF color );
  136. void  __vf  VCD_autoPlot(   cdVector X, ui size,
  137.                             unsigned form, COLORREF color );
  138. void  __vf  VCD_2AutoPlot(  cdVector X1, ui size1,
  139.                             unsigned form1, COLORREF color1,
  140.                             cdVector X2, ui size2,
  141.                             unsigned form2, COLORREF color2 );
  142. void  __vf  VCD_dataPlot(   cdVector X, ui size,
  143.                             unsigned form, COLORREF color );
  144.  
  145. #ifdef __BORLANDC__   /* 80-bit IEEE numbers supported.
  146.                          The following lines apply
  147.                          only to Borland C++            */
  148. void  __vf  VE_xyAutoPlot(  eVector X, eVector Y, ui size,
  149.                             unsigned form, COLORREF color );
  150. void  __vf  VE_xy2AutoPlot( eVector X1, eVector Y1, ui size1,
  151.                             unsigned form1, COLORREF color1,
  152.                             eVector X2, eVector Y2, ui size2,
  153.                             unsigned form2, COLORREF color2 );
  154. void  __vf  VE_xyDataPlot(  eVector X, eVector Y, ui size,
  155.                             unsigned form, COLORREF color );
  156. void  __vf  VE_yAutoPlot(   eVector Y, ui size,
  157.                             unsigned form, COLORREF color );
  158. void  __vf  VE_y2AutoPlot(  eVector Y1, ui size1,
  159.                             unsigned form1, COLORREF color1,
  160.                             eVector Y2, ui size2,
  161.                             unsigned form2, COLORREF color2 );
  162. void  __vf  VE_yDataPlot(   eVector Y, ui size,
  163.                             unsigned form, COLORREF color );
  164. void  __vf  VCE_autoPlot(   ceVector X, ui size,
  165.                             unsigned form, COLORREF color );
  166. void  __vf  VCE_2AutoPlot(  ceVector X1, ui size1,
  167.                             unsigned form1, COLORREF color1,
  168.                             ceVector X2, ui size2,
  169.                             unsigned form2, COLORREF color2 );
  170. void  __vf  VCE_dataPlot(   ceVector X, ui size,
  171.                             unsigned form, COLORREF color );
  172.  
  173. #else   /* no 80-bit IEEE number support:
  174.      the following lines apply only to Visual C++ and Optima++ */
  175. #define VE_xyAutoPlot       VD_xyAutoPlot
  176. #define VE_xy2AutoPlot      VD_xy2AutoPlot
  177. #define VE_xyDataPlot       VD_xyDataPlot
  178. #define VE_yAutoPlot        VD_yAutoPlot
  179. #define VE_y2AutoPlot       VD_y2AutoPlot
  180. #define VE_yDataPlot        VD_yDataPlot
  181. #define VCE_autoPlot        VCD_autoPlot
  182. #define VCE_2AutoPlot       VCD_2AutoPlot
  183. #define VCE_dataPlot        VCD_dataPlot
  184.  
  185. #endif  /* 80-bit real support */
  186.  
  187. void  __vf  VSI_xyAutoPlot(  siVector X, siVector Y, ui size,
  188.                              unsigned form, COLORREF color );
  189. void  __vf  VSI_xy2AutoPlot( siVector X1, siVector Y1, ui size1,
  190.                              unsigned form1, COLORREF color1,
  191.                              siVector X2, siVector Y2, ui size2,
  192.                              unsigned form2, COLORREF color2 );
  193. void  __vf  VSI_xyDataPlot(  siVector X, siVector Y, ui size,
  194.                              unsigned form, COLORREF color );
  195. void  __vf  VSI_yAutoPlot(   siVector Y, ui size,
  196.                              unsigned form, COLORREF color );
  197. void  __vf  VSI_y2AutoPlot(  siVector Y1, ui size1,
  198.                              unsigned form1, COLORREF color1,
  199.                              siVector Y2, ui size2,
  200.                              unsigned form2, COLORREF color2 );
  201. void  __vf  VSI_yDataPlot(   siVector Y, ui size,
  202.                              unsigned form, COLORREF color );
  203.  
  204. void  __vf  VI_xyAutoPlot(  iVector X, iVector Y, ui size,
  205.                             unsigned form, COLORREF color );
  206. void  __vf  VI_xy2AutoPlot( iVector X1, iVector Y1, ui size1,
  207.                             unsigned form1, COLORREF color1,
  208.                             iVector X2, iVector Y2, ui size2,
  209.                             unsigned form2, COLORREF color2 );
  210. void  __vf  VI_xyDataPlot(  iVector X, iVector Y, ui size,
  211.                             unsigned form, COLORREF color );
  212. void  __vf  VI_yAutoPlot(   iVector Y, ui size,
  213.                             unsigned form, COLORREF color );
  214. void  __vf  VI_y2AutoPlot(  iVector Y1, ui size1,
  215.                             unsigned form1, COLORREF color1,
  216.                             iVector Y2, ui size2,
  217.                             unsigned form2, COLORREF color2 );
  218. void  __vf  VI_yDataPlot(   iVector Y, ui size,
  219.                             unsigned form, COLORREF color );
  220.  
  221. void  __vf  VLI_xyAutoPlot(  liVector X, liVector Y, ui size,
  222.                              unsigned form, COLORREF color );
  223. void  __vf  VLI_xy2AutoPlot( liVector X1, liVector Y1, ui size1,
  224.                              unsigned form1, COLORREF color1,
  225.                              liVector X2, liVector Y2, ui size2,
  226.                              unsigned form2, COLORREF color2 );
  227. void  __vf  VLI_xyDataPlot(  liVector X, liVector Y, ui size,
  228.                              unsigned form, COLORREF color );
  229. void  __vf  VLI_yAutoPlot(   liVector Y, ui size,
  230.                              unsigned form, COLORREF color );
  231. void  __vf  VLI_y2AutoPlot(  liVector Y1, ui size1,
  232.                              unsigned form1, COLORREF color1,
  233.                              liVector Y2, ui size2,
  234.                              unsigned form2, COLORREF color2 );
  235. void  __vf  VLI_yDataPlot(   liVector Y, ui size,
  236.                              unsigned form, COLORREF color );
  237.  
  238. void  __vf  VQI_xyAutoPlot(  qiVector X, qiVector Y, ui size,
  239.                              unsigned form, COLORREF color );
  240. void  __vf  VQI_xy2AutoPlot( qiVector X1, qiVector Y1, ui size1,
  241.                              unsigned form1, COLORREF color1,
  242.                              qiVector X2, qiVector Y2, ui size2,
  243.                              unsigned form2, COLORREF color2 );
  244. void  __vf  VQI_xyDataPlot(  qiVector X, qiVector Y, ui size,
  245.                              unsigned form, COLORREF color );
  246. void  __vf  VQI_yAutoPlot(   qiVector Y, ui size,
  247.                              unsigned form, COLORREF color );
  248. void  __vf  VQI_y2AutoPlot(  qiVector Y1, ui size1,
  249.                              unsigned form1, COLORREF color1,
  250.                              qiVector Y2, ui size2,
  251.                              unsigned form2, COLORREF color2 );
  252. void  __vf  VQI_yDataPlot(   qiVector Y, ui size,
  253.                              unsigned form, COLORREF color );
  254.  
  255. void  __vf  VUS_xyAutoPlot(  usVector X, usVector Y, ui size,
  256.                              unsigned form, COLORREF color );
  257. void  __vf  VUS_xy2AutoPlot( usVector X1, usVector Y1, ui size1,
  258.                              unsigned form1, COLORREF color1,
  259.                              usVector X2, usVector Y2, ui size2,
  260.                              unsigned form2, COLORREF color2 );
  261. void  __vf  VUS_xyDataPlot(  usVector X, usVector Y, ui size,
  262.                              unsigned form, COLORREF color );
  263. void  __vf  VUS_yAutoPlot(   usVector Y, ui size,
  264.                              unsigned form, COLORREF color );
  265. void  __vf  VUS_y2AutoPlot(  usVector Y1, ui size1,
  266.                              unsigned form1, COLORREF color1,
  267.                              usVector Y2, ui size2,
  268.                              unsigned form2, COLORREF color2 );
  269. void  __vf  VUS_yDataPlot(   usVector Y, ui size,
  270.                              unsigned form, COLORREF color );
  271.  
  272. void  __vf  VU_xyAutoPlot(  uVector X, uVector Y, ui size,
  273.                             unsigned form, COLORREF color );
  274. void  __vf  VU_xy2AutoPlot( uVector X1, uVector Y1, ui size1,
  275.                             unsigned form1, COLORREF color1,
  276.                             uVector X2, uVector Y2, ui size2,
  277.                             unsigned form2, COLORREF color2 );
  278. void  __vf  VU_xyDataPlot(  uVector X, uVector Y, ui size,
  279.                             unsigned form, COLORREF color );
  280. void  __vf  VU_yAutoPlot(   uVector Y, ui size,
  281.                             unsigned form, COLORREF color );
  282. void  __vf  VU_y2AutoPlot(  uVector Y1, ui size1,
  283.                             unsigned form1, COLORREF color1,
  284.                             uVector Y2, ui size2,
  285.                             unsigned form2, COLORREF color2 );
  286. void  __vf  VU_yDataPlot(   uVector Y, ui size,
  287.                             unsigned form, COLORREF color );
  288.  
  289. void  __vf  VUL_xyAutoPlot(  ulVector X, ulVector Y, ui size,
  290.                              unsigned form, COLORREF color );
  291. void  __vf  VUL_xy2AutoPlot( ulVector X1, ulVector Y1, ui size1,
  292.                              unsigned form1, COLORREF color1,
  293.                              ulVector X2, ulVector Y2, ui size2,
  294.                              unsigned form2, COLORREF color2 );
  295. void  __vf  VUL_xyDataPlot(  ulVector X, ulVector Y, ui size,
  296.                              unsigned form, COLORREF color );
  297. void  __vf  VUL_yAutoPlot(   ulVector Y, ui size,
  298.                              unsigned form, COLORREF color );
  299. void  __vf  VUL_y2AutoPlot(  ulVector Y1, ui size1,
  300.                              unsigned form1, COLORREF color1,
  301.                              ulVector Y2, ui size2,
  302.                              unsigned form2, COLORREF color2 );
  303. void  __vf  VUL_yDataPlot(   ulVector Y, ui size,
  304.                              unsigned form, COLORREF color );
  305.  
  306. #ifdef V_HUGE
  307.     #define VUI_xyAutoPlot    VUL_xyAutoPlot
  308.     #define VUI_xy2AutoPlot   VUL_xy2AutoPlot
  309.     #define VUI_xyDataPlot    VUL_xyDataPlot
  310.     #define VUI_yAutoPlot     VUL_yAutoPlot
  311.     #define VUI_y2AutoPlot    VUL_y2AutoPlot
  312.     #define VUI_yDataPlot     VUL_yDataPlot
  313. #else
  314.     #define VUI_xyAutoPlot    VU_xyAutoPlot
  315.     #define VUI_xy2AutoPlot   VU_xy2AutoPlot
  316.     #define VUI_xyDataPlot    VU_xyDataPlot
  317.     #define VUI_yAutoPlot     VU_yAutoPlot
  318.     #define VUI_y2AutoPlot    VU_y2AutoPlot
  319.     #define VUI_yDataPlot     VU_yDataPlot
  320. #endif
  321.  
  322. #ifdef __cplusplus
  323. }  // end of extern "C" statement
  324. #endif
  325.  
  326. /*   Plotting Styles
  327.      The linestyles defined for DOS in Borland's <graphics.h> are
  328.      translated into the appropriate MS-WINDOWS pen styles.
  329.      The other way round, MS-WINDOWS pen styles are translated
  330.      into BGI linestyles for DOS programs. */
  331.  
  332. #if defined _Windows || defined _WINDOWS
  333.    #define SOLID_LINE  PS_SOLID
  334.    #define DOTTED_LINE PS_DOT
  335.    #define CENTER_LINE PS_DASHDOT
  336.    #define DASHED_LINE PS_DASH
  337.    #define NULL_LINE   PS_NULL
  338.    /*  "USERBIT_LINE" cannot be translated */
  339. #else
  340.    #define PS_SOLID       SOLID_LINE
  341.    #define PS_DASH        DASHED_LINE
  342.    #define PS_DOT         DOTTED_LINE
  343.    #define PS_DASHDOT     CENTER_LINE
  344.    #define PS_DASHDOTDOT  USERBIT_LINE /* dahdotdot pattern set internally */
  345.    #define PS_NULL        5
  346.    #define PS_INSIDEFRAME SOLID_LINE /* not exactly */
  347.    #define NULL_LINE      5          /* missing in BGI definitions */
  348. #endif
  349. #if !defined __BORLANDC__ && !defined _MSC_VER
  350.          /* definitions for Watcom */
  351.    #define PS_SOLID       WPStyleSolid
  352.    #define PS_DASH        WPStyleDash
  353.    #define PS_DOT         WPStyleDot
  354.    #define PS_DASHDOT     WPStyleDashDot
  355.    #define PS_DASHDOTDOT  WPStyleDashDotDot
  356. #endif
  357.  
  358. /* Definition of the symbols marking the data points: */
  359.  
  360. #define SY_NULL          0
  361. #define SY_CROSS         0x0100
  362. #define SY_PLUS          0x0200
  363. #define SY_STAR          0x0300
  364. #define SY_CIRCLE        0x0400
  365. #define SY_BOX           0x0500
  366. #define SY_DIAMOND       0x0600
  367. #define SY_TRIANGLEUP    0x0700  /* upwards-pointing triangle */
  368. #define SY_TRIANGLEDOWN  0x0800  /* downwards-pointing triangle */
  369.  
  370. /* Filling of the symbols: */
  371. #define SY_HOLLOW 0
  372. #define SY_DOTTED 0x1000
  373. #define SY_FILLED 0x2000
  374.  
  375. /*   Plotting Colors
  376.      The following colors are defined for MS-WINDOWS by analogy with
  377.      the COLORS defined for DOS programs in Borland's <graphics.h>:   */
  378. #if defined _Windows || defined _WINDOWS
  379.    #define __COLORS /*  overwrite COLORS of Borland C++'s <conio.h> */
  380.    #define   BLACK        (DWORD) 0UL             /* dark colors */
  381.    #define   BLUE         (DWORD) 0x00800000UL
  382.    #define   GREEN        (DWORD) 0x00008000UL
  383.    #define   CYAN         (DWORD) 0x00808000UL
  384.    #define   RED          (DWORD) 0x000000B0UL
  385.    #define   MAGENTA      (DWORD) 0x00800080UL
  386.    #define   BROWN        (DWORD) 0x00000080UL
  387.    #define   LIGHTGRAY    (DWORD) 0x00808080UL
  388.    #define   DARKGRAY     (DWORD) 0x00B0B0B0UL   /* light colors */
  389.    #define   LIGHTBLUE    (DWORD) 0x00FF0000UL
  390.    #define   LIGHTGREEN   (DWORD) 0x0000FF00UL
  391.    #define   LIGHTCYAN    (DWORD) 0x00FFFF00UL
  392.    #define   LIGHTRED     (DWORD) 0x000000FFUL
  393.    #define   LIGHTMAGENTA (DWORD) 0x00FF00FFUL
  394.    #define   YELLOW       (DWORD) 0x0000FFFFUL
  395.    #define   WHITE        (DWORD) 0x00FFFFFFUL
  396. #endif
  397.  
  398. #endif /* __VGRAPH_H */
  399.